package main.java.com.extract.sub;

/**
 * @description: 修车厂的工作报价
 * @author: cong zhi
 * @createDate: 2022/6/13 8:02
 * @updateUser: cong zhi
 * @updateDate: 2022/6/13 8:02
 * @updateRemark: 修改内容
 * @version: v1.0
 */
public class JobItem {

    protected int unitPrice;

    protected int quantity;

    protected boolean labor;

    private int rate;


    public JobItem(int unitPrice, int quantity) {
        this(unitPrice, quantity, false);
    }

    protected JobItem(int unitPrice, int quantity, boolean isLabor) {
        this.unitPrice = unitPrice;
        this.quantity = quantity;
        this.labor = isLabor;
    }

    public int getTotalPrice() {
        return getUnitPrice() * quantity;
    }

    public int getUnitPrice() {
        return unitPrice;
    }

    public int getQuantity() {
        return quantity;
    }

    public void setQuantity(int quantity) {
        this.quantity = quantity;
    }

    /**
     * 摆脱isLabor 值域;改为多态常量函数（这样的函数会在不同的子类实现版本中返回不同的固定值）
     *
     * @return
     */
    protected boolean isLabor() {
        return false;
    }


    public void setLabor(boolean labor) {
        this.labor = labor;
    }

    public int getRate() {
        return rate;
    }

    public void setRate(int rate) {
        this.rate = rate;
    }


}
